package my.mark.mybaibaoxiang.eventDemo.custom.listener;

import my.mark.mybaibaoxiang.eventDemo.custom.ApplicationListener;
import my.mark.mybaibaoxiang.eventDemo.custom.EventListener;
import my.mark.mybaibaoxiang.eventDemo.custom.RegistEvent;
import my.mark.mybaibaoxiang.eventDemo.custom.Tx;
import my.mark.mybaibaoxiang.eventDemo.tests.TestDomain;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Description: app注册事件监听
 * @Author wxming
 * @Date 2019年3月25日 下午3:39:22
 */
@EventListener(stop = false)
public class RegistEventListener implements ApplicationListener<RegistEvent> {

    private final Logger LOG = LoggerFactory.getLogger(RegistEventListener.class);

    @Tx
    @Override
    public void onApplicationEvent(RegistEvent event) {
        StringBuilder sbLog = new StringBuilder("send_dida_quan").append("\t");
        try {
            //注册回调
            TestDomain customer = (TestDomain) event.getSource();
            //非app访问返回
            //业务合作处理
            LOG.info("===================注册监听具体方法执行了");

        } catch (Exception e) {
            LOG.error("app注册回调异常", e);
        }
    }

}
